Skip to content

946: Distance-based node collapsing for 2D Network View#1687

Open
glstott wants to merge 10 commits into
CDCgov:devfrom
glstott:946
Open

946: Distance-based node collapsing for 2D Network View#1687
glstott wants to merge 10 commits into
CDCgov:devfrom
glstott:946

Conversation

@glstott

@glstott glstott commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

This addresses enhancement #946.

Summary

  • Adds distance-based node collapsing to the 2D Network view.
  • Adds a new “Collapse Related Nodes” settings panel with:
    • Enable/disable toggle
    • Distance threshold slider/input
    • Metric-aware labels and steps for TN93 percentage, TN93 decimal, and SNPs
  • Collapses threshold-connected distance components into aggregate nodes.
  • Scales aggregate nodes by member count.
  • Renders multi-category aggregate nodes as pie charts using node color groups.
  • Drops internal/self links created by collapsed members and retargets external links to aggregate nodes.
  • Adds aggregate-node tooltips with Bubble-style tables showing:
    • Category counts
    • Percentages
    • Total node count
    • Mean internal distance
  • Adds a warning when collapse is enabled while non-circle node shapes are active, since collapsed nodes render as circles.
  • Adds shared pie-chart SVG utilities and reuses them in both Bubble and 2D Network rendering.
  • Preserves color opacity/transparency in collapsed pie rendering.
  • Improves SVG export so collapsed pie images remain embedded and get proper outlines.
  • Refreshes collapse controls when global distance metric or display format changes.
  • Fixes 2D render/update handling for aggregate node IDs and retargeted Cytoscape edges.
  • Adds minor 2D UI layering and button styling corrections.
  • Adds Cypress coverage for collapse behavior, warnings, tooltips, SVG export, and metric/format control updates.
  • Adds collapse-specific Cypress fixtures for mean-distance validation.

@glstott

glstott commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

Mergest complete. Ready for testing and merging with dev.

@dacowan404

Copy link
Copy Markdown
Collaborator

Merged pull request into dev-update-Aug26_DC branch. Overall I think it looks good but have a few thoughts:

  1. I feel that we don't need both the slider and the number input (it seems like 2 features controlling the same things). I prefer number input with increment.
  2. Max value allowed for variable. Currently seems to be set at max distance found in the dataset which allows combining clusters into a collapsed node which can be confusing. I think max should be set at current link threshold to prevent this.
    2.a. Additionally loading data from nextstrain (where all distances haven't been calculated). The max in this case is the max link threshold that has been calculated, on load is the default distance threshold. Increasing the global link threshold updates max known link distance but this isn't immediately reflected in the slider/input.
  3. Collapsing nodes positioning can be weird. Sometimes they appear on top of each other and recalculating position doesn't change that.
  4. Similar to that, Collapsed nodes has unexpected behavior when using in conjunction with grouping. Is there way to ensure these settings work together?
  5. Timeline mode, intermediate collapsed nodes move around before finally moving to final position. I am not sure what is triggering this, at the end of timeline they seem to be in right position; they also don't rearrange every time a node is add just some of the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants